<?php
/*
 * @Author: 李明
 * @Date: 2021-09-29 15:59:40
 * @LastEditTime: 2021-11-30 18:04:51
 * @LastEditors: 李明
 * @Description: 
 * @FilePath: /CRM2.0-PHP/app/Http/Controllers/system/SystemRecordController.php
 * @山东壹零贰肆信息科技有限公司
 */

namespace App\Http\Controllers\system;

use App\Http\Controllers\common\LMReturn;
use App\Http\Controllers\Controller;
use App\Models\SystemRecord;
use Illuminate\Http\Request;

class SystemRecordController extends Controller
{
    public function querySystemRecord(Request $request)
    {
        //去验证token值
        $tokenInfo = json_decode($this->verifyTokenLm(), true);
        //判断传递过来的token的code码是否等于400  如果是400的话，提示token不正确
        if ($tokenInfo['code'] == 400) {
            return LMReturn::Error($tokenInfo['msg'], $tokenInfo['code']);
        }
        $all = $request->all();
        try {
            $pageSize = isset($all['size']) ? $all['size'] : '15';
            $system_record = SystemRecord::paginate($pageSize);
            return LMReturn::Success($system_record, '查询成功');
        } catch (\Throwable $th) {
            return LMReturn::Error('发生错误', 'SR001');
        }
    }
}
